﻿@model TelecomGis.Controllers.modelViewThueBaoOnGPon

<div id="List_TBGPON_VIEW_ONE_LAPTB" style="width:780px; height:300px; margin:20px; height:320px"></div>
<div style="text-align:center; padding:5px 0">
    <button type="button" onclick="return close_window_elements('window_addupdate_view_thue_bao');" >
                <span class="l-btn-left l-btn-icon-left"><span class="l-btn-text">Đóng windown</span><span class="l-btn-icon icon-remove">&nbsp;</span></span></button>
</div>
<script type="text/javascript">

    $('#List_TBGPON_VIEW_ONE_LAPTB').jtable({

        title: 'DS LẮP THUÊ BAO GPON',
        openChildAsAccordion: true,
        actions: {
            listAction: _nameSubDomain + '/ONTGpon/ListONTByTbId?TbId=@Model.idMainTB',

        },
        height : '300px',
        fields: {
            ONTID: {
                key: true,
                edit: false,
                create: false,
                //list:false,
                width: '3%',
                display: function (tbData) {
                    var $img_port = $('<img src="' + _nameSubDomain + '/Content/images/congviec-icon.png" style="cursor:pointer;" title="Thuê Bao GPON" />');
                    //Open child table when user clicks the image
                    $img_port.click(function () {
                        $('#List_TBGPON_VIEW_ONE_LAPTB').jtable('openChildTable',
                               $img_port.closest('tr'), //Parent row
                               {
                                   title: 'DS THUÊ BAO GPON ',
                                   actions: {
                                       listAction: _nameSubDomain + '/ONTGpon/ListTHUEBAOONTByTbId?ontId=' + tbData.record.ONTID,
                                   },
                                   fields: {
                                       ID: {
                                           key: true,
                                           list: false,
                                       },
                                       THUEBAO_ID: {
                                           title: 'Thuê Bao',
                                           width: '30%',
                                           display: function (data) {
                                               if (data.record.THUEBAO_ID == null) return "";
                                               else return GetThueBaoCssOntById(data.record.THUEBAO_ID).TEN_TB;
                                           }
                                       },
                                       SITE_ID: {
                                           title: 'Vnpt Site',
                                           width: '30%',
                                           display: function (data) {
                                               if (data.record.SITE_ID == null) return "";
                                               else return Get_vnpt_site_ById(data.record.SITE_ID).TEN;
                                           }
                                       },
                                       GHI_CHU: {
                                           title: 'Ghi Chú',
                                           width: '20%'
                                       },

                                   }
                               }, function (data) { //opened handler
                                   data.childTable.jtable('load');
                               });
                    });
                    //Return image to show on the person row
                    return $img_port;
                }

            },
            THUTU: {
                title: 'Thứ tự',
                width: '20%'
            },
            ONU_ID: {
                title: 'ONT Id',
                width: '20%'
            },
            VISA: {
                title: 'Visa',
                width: '10%'
            },
            SERIAL: {
                title: 'Serial',
                width: '10%'

            },
            ACCOUNT: {
                title: 'Account',
                width: '10%'
            },
            THIETBI_ONT: {
                title: 'Thiết bị ONT',
                width: '20%'
            },
            TRANGTHAI: {
                title: 'Trạng thái',
                width: '20%',
                display: function (data) {
                    return getTrangthaibyId(data.record.TRANGTHAI).TRANGTHAI1;
                }
            },
            GHI_CHU: {
                title: 'Ghi chú',
                width: '20%'
            },

        },
        //Initialize validation logic when a form is created
        formCreated: function (event, data) {
            //data.form.find('input[name="TEN"]').addClass('validate[required]');
            data.form.validationEngine();
        },

    });

    $('#List_TBGPON_VIEW_ONE_LAPTB').jtable('load');

</script>
